<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/ajax.js"></script>
    <script src="/html/js/util.js"></script>
    <script>
        window.onload=function (){
            let errorInfo=getQuery("errorInfo");
            if (errorInfo=='noland'){
                getObject("errorDiv").innerHTML="对不起，请先登录";
            }else if (errorInfo=="nograde"){
                getObject("errorDiv").innerHTML="对不起，你没有权限"
            }
        }
        async function login(){
            let info=await ajaxGet("/user/login",{name:getObject("name").value,pwd:getObject("pwd").value});
            if (info=="顾客") {
                location.href = "/html/index.html";
            }else if (info=="管理员") {
                location.href = "/html/manager/pressOrder.html";
            }else if(info=="送货员") {
                location.href = "/html/send/sendOrder.html";
            }else if(info=="经理"){
                location.href = "/html/ass/index.html";
            }else {
                getObject("errorDiv").innerHTML="用户名或密码错误";
            }
        }
    </script>
</head>
<body>

   <div style="margin: 0 auto;width: 50%;height: 50%;margin-top: 100px">
       <div style="color: red;font-size: 12px" id="errorDiv"></div>
       用户名:<input type="text" id="name" style="margin-top: 20px"><br>
       密码:<input type="text" id="pwd" style="margin-top: 20px"><br>
       <input type="button" value="登录" onclick="login()" style="margin-top: 20px">
   </div>

</body>
</html>